package com.pg.agent.engine.client.common.enums;

import java.util.Arrays;

/**
 * 出参类型
 *
 * @author huhuaping
 * @date 2024/01/05 9:41
 */
public enum ComponentOutParamTypeEnum {
    OUT(1, "OUT", "直接输出至客户端"),
    PROMPT(2, "PROMPT", "封装为提示词"),
    IN_PARAM(3, "IN_PARAM", "组件入参"),
    JSON(4, "json", "json");

    /**
     * 值
     */
    private Integer value;
    /**
     * 编码
     */
    private String code;
    /**
     * 说明
     */
    private String desc;

    ComponentOutParamTypeEnum() {

    }

    ComponentOutParamTypeEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    ComponentOutParamTypeEnum(Integer value, String code, String desc) {
        this.value = value;
        this.code = code;
        this.desc = desc;
    }

    public static String getCodeByValue(Integer value) {

        ComponentOutParamTypeEnum controllerTypeEnum = Arrays.stream(values()).filter(e -> e.value.equals(value)).findFirst().orElse(null);

        return controllerTypeEnum == null ? "" : controllerTypeEnum.code;
    }

    public Integer getValue() {
        return value;
    }


    public String getDesc() {
        return desc;
    }


    public String getCode() {
        return code;
    }


}
